import {HttpClient} from '@angular/common/http';
import {Injectable} from '@angular/core';
import {catchError, throwError} from "rxjs";


//封装接口api
@Injectable({
  providedIn: 'root'
})
export class LoginService {

  baseurl = '';

  constructor(private httpClient: HttpClient) {}

  //封装接口api
  login(username: string, password: string) {
    return this.httpClient.post(
      this.baseurl + "/login",
      {username, password}
    ).pipe(
      catchError(err => throwError(err))
    )

  }


}
